package com.tom.demo.service.stockmarket.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tom.demo.common.entity.StockMarket;
import com.tom.demo.mapper.StockMarketMapper;
import com.tom.demo.service.stockmarket.StockMarketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class StockMarketServiceImpl implements StockMarketService {

    @Resource
    private StockMarketMapper stockMarketMapper;

    @Override
    public ResponseEntity<PageInfo<StockMarket>> pageList(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        List<StockMarket> stockMarketList = stockMarketMapper.findByPage();
        PageInfo<StockMarket> pageInfo = new PageInfo<>(stockMarketList);
        return ResponseEntity.ok(pageInfo);
    }
}
